package com.study.selection.service;

import com.study.selection.dao.TeacherDao;
import com.study.selection.model.Teacher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TeacherServiceImpl implements TeacherService {

    @Autowired
    private TeacherDao teacherDao;

    @Override
    public List<Teacher> findAll() {
        return teacherDao.findAll();
    }

    @Override
    public List<Teacher> findByKey(String key) {
        return teacherDao.findByKey(key);
    }

    @Override
    public boolean addTeacher(Teacher teacher) {
        return teacherDao.addTeacher(teacher) > 0 ? true : false;
    }

    @Override
    public List<Teacher> getByCollegeId(int collegeId){
        return teacherDao.getByCollegeId(collegeId);
    }
    @Override
    public Teacher getByTeacherId(int teacherId) {
        return teacherDao.getByTeacherId(teacherId);
    }

    @Override
    public boolean updateTeacher(Teacher teacher) {
        return teacherDao.updateTeacher(teacher) > 0 ? true : false;
    }
    @Override
    public boolean deleteTeacher(int teacherId) {
        return teacherDao.deleteTeacher(teacherId) > 0 ? true : false;
    }


}
